import Vue from 'vue'
import Vuex from 'vuex'
import student from './student'
import product from './product'
Vue.use(Vuex);

export default new Vuex.Store({
    modules:{
        student,product
    },
    state:{
        count:0,
        message:'hello'
    },
    getters:{
        message(state){
            return state.message.split('').reverse().join('')
        }
    },
    mutations:{
        increment(state){
            setTimeout(() => {

                state.count++;
            },1000)
        }
    },
    actions:{
        increment(context){
            console.log("action");
            setTimeout(() => {
                context.commit('increment')
            },1000)
            
        }
    }
});